import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: () => import('@/layout/index'),
        redirect: '/dashboard',
        children: [
            {
                path: 'dashboard',
                name: 'Dashboard',
                component: ()=>import('@/views/Dashboard.vue'),
                meta: {title: '首页'}
            }
        ]
    },
    {
        path: '/useradmin',
        name: 'UserAdmin',
        component: () => import('@/layout/index'),
        meta:{title:'人员管理'},
        children: [
            {
                path: 'employee',
                name: 'Employee',
                component: ()=>import('@/views/useradmin/Employee.vue'),
                meta: {title: '员工管理'}
            },
            {
                path: 'user',
                name: 'User',
                component: ()=>import('@/views/useradmin/User.vue'),
                meta: {title: '用户管理'}
            }
        ]
    },
    {
        path: '/dataadmin',
        name: 'DataAdmin',
        component: () => import('@/layout/index'),
        meta:{title:'系统管理'},
        children: [
            {
                path: 'userdata',
                name: 'UserData',
                component: ()=>import('@/views/dataadmin/UserData.vue'),
                meta: {title: '用户数据'}
            },
            {
                path: 'post',
                name: 'Post',
                component: ()=>import('@/views/dataadmin/Post.vue'),
                meta: {title: '帖子审核'}
            },
            {
                path: 'adminpost',
                name: 'AdminPost',
                component: ()=>import('@/views/dataadmin/AdminPost.vue'),
                meta: {title: '官方号管理'}
            }
        ]
    },
    {
        path:'/login',
        name:'Login',
        component:()=>import('@/views/Login.vue'),
    }
];


export default new Router({
    mode: 'history', 
    routes: routes
})